# cf/admin.py
from django.contrib import admin
from .models import CFUser, Submission, DailyStats

@admin.register(CFUser)
class CFUserAdmin(admin.ModelAdmin):
    list_display = ['username', 'handle', 'is_active', 'created_at', 'last_updated']
    list_filter = ['is_active', 'created_at']
    search_fields = ['username', 'handle']
    list_editable = ['is_active']

@admin.register(Submission)
class SubmissionAdmin(admin.ModelAdmin):
    list_display = ['user', 'problem_name', 'verdict', 'creation_time', 'contest_id', 'problem_index']
    list_filter = ['user', 'verdict', 'creation_time']
    search_fields = ['problem_name', 'submission_id', 'user__handle']

@admin.register(DailyStats)
class DailyStatsAdmin(admin.ModelAdmin):
    list_display = ['user', 'date', 'total_submissions', 'accepted_submissions', 'problems_solved']
    list_filter = ['user', 'date']
    readonly_fields = ['date']